package com.second.mapper;

import com.second.model.pojo.FCollection;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FCollectionMapper extends JpaRepository<FCollection,Integer> {

    //根据id查询收藏列表
    List<FCollection> findAllByUserId(Integer userId);

    //根据id查询收藏列表
    List<FCollection> findAllByUserIdAndStatus(Integer userId,Integer status);

    //根据shopId和userId查询单个藏品对象
    FCollection findByUserIdAndShopId(Integer userId,Integer shopId);

    //收藏分页
    Page<FCollection> findAllByUserIdAndStatus(Integer userId,Integer status,Pageable pageable);

    //当前用户收藏的数量
    int countByUserIdAndAndStatus(Integer userId,Integer status);
}

